<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->id();
            // 关联的工程项目 ID，可根据实际情况修改数据类型
            $table->unsignedBigInteger('project_id');
            $table->unsignedBigInteger('user_id');
            $table->unsignedBigInteger('payment_apply_id');
            // 付款金额，使用 decimal 类型精确存储货币值
            $table->decimal('amount', 10, 2);
            $table->decimal('price', 10, 2);
            // 付款日期，记录付款发生的日期
            $table->date('pay_date');
            // 付款方式，如现金、银行转账等，使用字符串类型存储
            $table->string('type');
            // 付款备注，可用于记录额外的付款信息
            $table->string('remarks')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
};
